package com.fowo.api.syncLingxingApi.entity;

import cn.hutool.extra.ssh.JschUtil;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fowo.api.common.annotaion.JoinField;
import com.fowo.api.entity.*;
import com.fowo.api.sys.entity.SysFile;
import com.fowo.api.sys.entity.SysUser;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.util.List;

@DS("ds24")
@Data
@TableName(value = "tmp_sync_lingxing_to_product", autoResultMap = true)
@Schema(title = "同步领星产品临时表")
public class TmpSyncLingxingToProduct {

    /**
     * 编号
     */
    @TableField(value = "`id`")
    @TableId(type = IdType.ASSIGN_ID)
    @Schema(title = "编号")
    private Long id;

    /**
     * 图片
     */
    @TableField(value = "`pic_url`", typeHandler = JacksonTypeHandler.class)
    @Schema(title = "图片")
    private List<SysFile> picUrl;

    /**
     * 款名
     */
    @TableField(value = "`spu_name`")
    @Schema(title = "款名")
    private String spuName;

    /**
     * SPU
     */
    @TableField(value = "`spu`")
    @Schema(title = "SPU")
    private String spu;

    /**
     * 品名
     */
    @TableField(value = "`name`")
    @Schema(title = "品名")
    private String name;

    /**
     * SKU
     */
    @TableField(value = "`sku`")
    @Schema(title = "SKU")
    private String sku;

    /**
     * 开启状态
     */
    @TableField(value = "`is_open`")
    @Schema(title = "开启状态")
    private Boolean isOpen;

    /**
     * 型号
     */
    @TableField(value = "`model`")
    @Schema(title = "型号")
    private String model;

    /**
     * 单位
     */
    @TableField(value = "`unit`")
    @Schema(title = "单位")
    private String unit;

    /**
     * 分类
     */
    @TableField(value = "`classify`")
    @JoinField(Classify.class)
    @Schema(title = "分类")
    private Long classify;

    /**
     * 品牌
     */
    @TableField(value = "`brand`")
    @JoinField(Brand.class)
    @Schema(title = "品牌")
    private Long brand;

    /**
     * 创建人
     */
    @TableField(value = "`create_user`")
    @JoinField(SysUser.class)
    @Schema(title = "创建人")
    private Long createUser;

    /**
     * 开发人
     */
    @TableField(value = "`developer`")
    @JoinField(SysUser.class)
    @Schema(title = "开发人")
    private Long developer;

    /**
     * 产品负责人
     */
    @TableField(value = "`principal`")
    @JoinField(SysUser.class)
    @Schema(title = "产品负责人")
    private Long principal;

    /**
     * 采购员
     */
    @TableField(value = "`buyer`")
    @JoinField(SysUser.class)
    @Schema(title = "采购员")
    private Long buyer;

    /**
     * 采购交期
     */
    @TableField(value = "`purchasing_delivery_time`")
    @Schema(title = "采购交期")
    private Integer purchasingDeliveryTime;

    /**
     * 采购成本
     */
    @TableField(value = "`procurement_cost`")
    @Schema(title = "采购成本")
    private java.math.BigDecimal procurementCost;

    /**
     * 单箱数量
     */
    @TableField(value = "`packing_num`")
    @Schema(title = "单箱数量")
    private Integer packingNum;

    /**
     * 外箱长度
     */
    @TableField(value = "`box_length`")
    @Schema(title = "外箱长度")
    private java.math.BigDecimal boxLength;

    /**
     * 外箱宽度
     */
    @TableField(value = "`box_width`")
    @Schema(title = "外箱宽度")
    private java.math.BigDecimal boxWidth;

    /**
     * 外箱高度
     */
    @TableField(value = "`box_height`")
    @Schema(title = "外箱高度")
    private java.math.BigDecimal boxHeight;

    /**
     * 单箱重量
     */
    @TableField(value = "`packing_weight`")
    @Schema(title = "单箱重量")
    private java.math.BigDecimal packingWeight;

    /**
     * 包装长度
     */
    @TableField(value = "`package_length`")
    @Schema(title = "包装长度")
    private java.math.BigDecimal packageLength;

    /**
     * 包装宽度
     */
    @TableField(value = "`package_width`")
    @Schema(title = "包装宽度")
    private java.math.BigDecimal packageWidth;

    /**
     * 包装高度
     */
    @TableField(value = "`package_height`")
    @Schema(title = "包装高度")
    private java.math.BigDecimal packageHeight;

    /**
     * 单品毛重
     */
    @TableField(value = "`product_gross`")
    @Schema(title = "单品毛重")
    private java.math.BigDecimal productGross;

    /**
     * 关联辅料数
     */
    @TableField(value = "`accessories_num`")
    @Schema(title = "关联辅料数")
    private String accessoriesNum;

    /**
     * 状态
     */
    @TableField(value = "`sales_status`")
    @Schema(title = "状态")
    private String salesStatus;

    /**
     * 1688配对状态
     */
    @TableField(value = "`is_matched_alibaba`")
    @Schema(title = "1688配对状态")
    private Boolean isMatchedAlibaba;

    /**
     * listing配对状态
     */
    @TableField(value = "`is_matched_listing`")
    @Schema(title = "listing配对状态")
    private Boolean isMatchedListing;

    /**
     * 创建时间
     */
    @TableField(value = "`create_time`")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Schema(title = "创建时间")
    private java.util.Date createTime;

    /**
     * 更新时间
     */
    @TableField(value = "`last_update_time`")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Schema(title = "更新时间")
    private java.util.Date lastUpdateTime;

    /**
     * 产品类型
     */
    @TableField(value = "`type`")
    @Schema(title = "产品类型")
    private String type;

    /**
     * 类别名
     */
    @TableField(value = "`product_type`")
    @Schema(title = "类别名")
    private String productType;

    /**
     * 分组
     */
    @TableField(value = "`group`")
    @JoinField(ProductGroup.class)
    @Schema(title = "分组")
    private Long group;

    /**
     * 更新人
     */
    @TableField(value = "`last_update_user`")
    @Schema(title = "更新人")
    private Long lastUpdateUser;

    /**
     * 删除标记
     */
    @TableField(value = "`del_flag`")
    @TableLogic
    @Schema(title = "删除标记")
    private Boolean delFlag;

    /**
     * 产品标签
     */
    @TableField(value = "`label`")
    @Schema(title = "产品标签")
    private String label;

    /**
     * 信息一
     */
    @TableField(value = "`info1`")
    @Schema(title = "信息一")
    private String info1;

    /**
     * 信息二
     */
    @TableField(value = "`info2`")
    @Schema(title = "信息二")
    private String info2;

    /**
     * 电镀颜色
     */
    @TableField(value = "`ep_color`")
    @Schema(title = "电镀颜色")
    private String epColor;

    /**
     * 产品描述
     */
    @TableField(value = "`product_description`")
    @Schema(title = "产品描述")
    private String productDescription;

    /**
     * 附件
     */
    @TableField(value = "`attachment`", typeHandler = JacksonTypeHandler.class)
    @Schema(title = "附件")
    private List<SysFile> attachment;

    /**
     * 采购备注
     */
    @TableField(value = "`remarks`")
    @Schema(title = "采购备注")
    private String remarks;

    /**
     * 公制英制
     */
    @TableField(value = "`metric_or_british`")
    @Schema(title = "公制英制")
    private String metricOrBritish;

    /**
     * 产品长度
     */
    @TableField(value = "`product_length`")
    @Schema(title = "产品长度")
    private java.math.BigDecimal productLength;

    /**
     * 产品宽度
     */
    @TableField(value = "`product_width`")
    @Schema(title = "产品宽度")
    private java.math.BigDecimal productWidth;

    /**
     * 产品高度
     */
    @TableField(value = "`product_height`")
    @Schema(title = "产品高度")
    private java.math.BigDecimal productHeight;

    /**
     * 产品净重
     */
    @TableField(value = "`product_net`")
    @Schema(title = "产品净重")
    private java.math.BigDecimal productNet;

    /**
     * 产品材质
     */
    @TableField(value = "`material`")
    @Schema(title = "产品材质")
    private String material;

    /**
     * 物流计价方式
     */
    @TableField(value = "`logistics_price_type`")
    @Schema(title = "物流计价方式")
    private String logisticsPriceType;

    /**
     * 采购计价方式
     */
    @TableField(value = "`purchase_price_type`")
    @Schema(title = "采购计价方式")
    private String purchasePriceType;

    /**
     * 主材价格
     */
    @TableField(value = "`price_type`")
    @Schema(title = "主材价格")
    private String priceType;

    /**
     * 申报单价
     */
    @TableField(value = "`customs_charges`")
    @Schema(title = "申报单价")
    private java.math.BigDecimal customsCharges;

    /**
     * 申报货币
     */
    @TableField(value = "`customs_currency`")
    @Schema(title = "申报货币")
    private String customsCurrency;

    /**
     * 中文报关名
     */
    @TableField(value = "`chinese_name`")
    @Schema(title = "中文报关名")
    private String chineseName;

    /**
     * 英文报关名
     */
    @TableField(value = "`english_name`")
    @Schema(title = "英文报关名")
    private String englishName;

    /**
     * 报关单位
     */
    @TableField(value = "`exporter`")
    @Schema(title = "报关单位")
    private String exporter;

    /**
     * 报关规格型号
     */
    @TableField(value = "`export_model`")
    @Schema(title = "报关规格型号")
    private String exportModel;

    /**
     * 原产国
     */
    @TableField(value = "`original_place`")
    @Schema(title = "原产国")
    private String originalPlace;

    /**
     * 境内货源地
     */
    @TableField(value = "`china_source`")
    @Schema(title = "境内货源地")
    private String chinaSource;

    /**
     * 征免
     */
    @TableField(value = "`exemption`")
    @Schema(title = "征免")
    private String exemption;

    /**
     * 特殊属性
     */
    @TableField(value = "`special_properties`")
    @Schema(title = "特殊属性")
    private String specialProperties;

    /**
     * 材质
     */
    @TableField(value = "`customs_material`")
    @Schema(title = "材质")
    private String customsMaterial;

    /**
     * 用途
     */
    @TableField(value = "`customs_use`")
    @Schema(title = "用途")
    private String customsUse;

    /**
     * 内部编码
     */
    @TableField(value = "`customs_code`")
    @Schema(title = "内部编码")
    private String customsCode;

    /**
     * 出口享惠情况
     */
    @TableField(value = "`customs_discounts`")
    @Schema(title = "出口享惠情况")
    private String customsDiscounts;

    /**
     * 品牌类型
     */
    @TableField(value = "`customs_brand`")
    @Schema(title = "品牌类型")
    private String customsBrand;

    /**
     * 产品型号
     */
    @TableField(value = "`customs_model`")
    @Schema(title = "产品型号")
    private String customsModel;

    /**
     * 配货备注
     */
    @TableField(value = "`customs_remark`")
    @Schema(title = "配货备注")
    private String customsRemark;

    /**
     * 织造方式
     */
    @TableField(value = "`customs_weave`")
    @Schema(title = "织造方式")
    private String customsWeave;

    /**
     * 质检方式
     */
    @TableField(value = "`check_type`")
    @Schema(title = "质检方式")
    private String checkType;

    /**
     * 是否开启批次管理
     */
    @TableField(value = "`is_batch`")
    @Schema(title = "是否开启批次管理")
    private Boolean isBatch;

    /**
     * 默认仓库
     */
    @TableField(value = "`default_warehouse`")
    @JoinField(Warehouse.class)
    @Schema(title = "默认仓库")
    private Long defaultWarehouse;

    /**
     * 上架策略
     */
    @TableField(value = "`putaway`")
    @Schema(title = "上架策略")
    private String putaway;

    /**
     * 盘点周期
     */
    @TableField(value = "`stocktaking`")
    @Schema(title = "盘点周期")
    private Integer stocktaking;

    /**
     * 清关图片
     */
    @TableField(value = "`customs_img`", typeHandler = JacksonTypeHandler.class)
    @Schema(title = "清关图片")
    private List<SysFile> customsImg;

    /**
     * 品牌名称
     */
    @TableField(value = "`trade_name`")
    @Schema(title = "品牌名称")
    private String tradeName;

    /**
     * 采购运输成本
     */
    @TableField(value = "`transport_cost`")
    @Schema(title = "采购运输成本")
    private java.math.BigDecimal transportCost;

    /**
     * 是否为组合商品
     */
    @TableField(value = "`is_combo`")
    @Schema(title = "是否为组合商品")
    private Boolean isCombo;

    /**
     * 供应商报价信息
     */
    @TableField(value = "`supplier_quote`")
    @Schema(title = "供应商报价信息")
    private String supplierQuote;

    /**
     * 零星产品id
     */
    @TableField(value = "`lx_product_id`")
    @Schema(title = "零星产品id")
    private Long lxProductId;

    @TableField(value = "`_flag`")
    @Schema(title = "比较标记")
    private Integer _flag;

    @TableField(value = "`_version`")
    @Schema(title = "比较版本")
    private String _version;

    @TableField(value = "`_pic_url`")
    @Schema(title = "领星图片")
    private String _picUrl;

    public void copyProductToTmpProduct(Product oldOne, int flag, String version) {
        this.setId(oldOne.getId());
        this.setSpuName(oldOne.getSpuName());
        this.setSpu(oldOne.getSpu());
        this.setName(oldOne.getName());
        this.setSku(oldOne.getSku());
        this.setIsOpen(oldOne.getIsOpen());
        this.setModel(oldOne.getModel());
        this.setUnit(oldOne.getUnit());
        this.setClassify(oldOne.getClassify());
        this.setBrand(oldOne.getBrand());
        this.setCreateUser(oldOne.getCreateUser());
        this.setDeveloper(oldOne.getDeveloper());
//         this.setPrincipal( oldOne.getPrincipal());
        this.setBuyer(oldOne.getBuyer());
        this.setPurchasingDeliveryTime(oldOne.getPurchasingDeliveryTime());
        this.setProcurementCost(oldOne.getProcurementCost());
        this.setPackingNum(oldOne.getPackingNum());
        this.setBoxLength(oldOne.getBoxLength());
        this.setBoxWidth(oldOne.getBoxWidth());
        this.setPackingWeight(oldOne.getPackingWeight());
        this.setPackageLength(oldOne.getPackageLength());
        this.setPackageWidth(oldOne.getPackageWidth());
        this.setPackageHeight(oldOne.getPackageHeight());
        this.setProductGross(oldOne.getProductGross());
        this.setAccessoriesNum(oldOne.getAccessoriesNum());
        this.setSalesStatus(oldOne.getSalesStatus());
        this.setIsMatchedListing(oldOne.getIsMatchedListing());
        this.setIsMatchedAlibaba(oldOne.getIsMatchedAlibaba());
        this.setCreateTime(oldOne.getCreateTime());
        this.setLastUpdateTime(oldOne.getLastUpdateTime());
        this.setType(oldOne.getType());
        this.setProductType(oldOne.getProductType());
        this.setGroup(oldOne.getGroup());
        this.setDelFlag(oldOne.getDelFlag());
        this.setLabel(oldOne.getLabel());
        this.setInfo1(oldOne.getInfo1());
        this.setInfo2(oldOne.getInfo2());
        this.setEpColor(oldOne.getEpColor());
        this.setProductDescription(oldOne.getProductDescription());
        this.setAttachment(oldOne.getAttachment());
        this.setRemarks(oldOne.getRemarks());
        this.setMetricOrBritish(oldOne.getMetricOrBritish());
        this.setProductWidth(oldOne.getProductWidth());
        this.setProductHeight(oldOne.getProductHeight());
        this.setProductNet(oldOne.getProductNet());
        this.setMaterial(oldOne.getMaterial());
        this.setPurchasePriceType(oldOne.getPurchasePriceType());
        this.setLogisticsPriceType(oldOne.getLogisticsPriceType());
        this.setPriceType(oldOne.getPriceType());
        this.setCustomsCharges(oldOne.getCustomsCharges());
        this.setCustomsCurrency(oldOne.getCustomsCurrency());
        this.setChineseName(oldOne.getChineseName());
        this.setEnglishName(oldOne.getEnglishName());
        this.setExporter(oldOne.getExporter());
        this.setExportModel(oldOne.getExportModel());
        this.setOriginalPlace(oldOne.getOriginalPlace());
        this.setChinaSource(oldOne.getChinaSource());
        this.setExemption(oldOne.getExemption());
        this.setSpecialProperties(oldOne.getSpecialProperties());
        this.setCustomsMaterial(oldOne.getCustomsMaterial());
        this.setCustomsUse(oldOne.getCustomsMaterial());
        this.setCustomsCode(oldOne.getCustomsCode());
        this.setCustomsDiscounts(oldOne.getCustomsDiscounts());
        this.setCustomsBrand(oldOne.getCustomsBrand());
        this.setCustomsModel(oldOne.getCustomsModel());
        this.setCustomsRemark(oldOne.getCustomsRemark());
        this.setCustomsWeave(oldOne.getCustomsWeave());
        this.setCheckType(oldOne.getCheckType());
        this.setIsBatch(oldOne.getIsBatch());
        this.setDefaultWarehouse(oldOne.getDefaultWarehouse());
        this.setPutaway(oldOne.getPutaway());
        this.setStocktaking(oldOne.getStocktaking());
        this.setCustomsImg(oldOne.getCustomsImg());
        this.setTradeName(oldOne.getTradeName());
        this.setTransportCost(oldOne.getTransportCost());
        this.setIsCombo(oldOne.getIsCombo());
        this.setSupplierQuote(oldOne.getSupplierQuote());
        this.setLxProductId(oldOne.getLxProductId());
        this.set_flag(flag); // 1.update 2.insert
        this.set_version(version);

    }
}
